<?php

/******************************************
 * File:			libs.php
 * Version:			1.0.1
 * Last modified:	21/10/2009
 * Last modifier:	Hugo Lavigne
 *****************************************/

imports("odt_frm_php.files");
imports("odt_frm_php.err");

$PWerr = new PW_err();

Function load_libs()
{
	GLOBAL	$path_php;
	GLOBAL	$PWerr;
	
	$files = get_file_list($path_php);
	if (!is_array($files))
	{
		$PWerr->sWarning("PHP Web librairies load error !", 171);
		return (-1);
	}
	
	$nb = count($files);
	$i = 0;
	while ($i < $nb)
	{
		if (strncmp('lib_', $files[$i], 4) == 0)
		{
			if (!is_load($files[$i]))
			{
				$name = substr($files[$i], -(strlen($files[$i]) - 4));
				$tab = explode('.', $name);
				$lib = $tab[0];
				imports("odt_frm_php.$lib");
			}
		}
		$i++;
	}
	return;
}

Function is_load($lib)
{
	$libs = array('files', 'imports', 'sessions', 'err');
	$nb = count($libs);
	$i = 0;
	while ($i < $nb)
	{
		if (strcmp($lib, "lib_$libs[$i].inc") == 0)
			return (TRUE);
		$i++;
	}
	return (FALSE);
}

?>